x11: Relax requirements for setting ParentRelative
authorEvangelos Foutras <evangelos@foutrelis.com>
Sat, 11 Apr 2015 08:20:56 +0000 (11:20 +0300)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 13 Apr 2015 12:26:15 +0000 (08:26 -0400)
XSetWindowBackgroundPixmap() will throw BadMatch only in the case of a
different parent window depth. Different visuals are fine and actually
expected in Gtk+ 3.16 (since we don't stick to the system default visual
but try to pick a better one).

https://bugzilla.gnome.org/show_bug.cgi?id=747524

gdk/x11/gdkwindow-x11.c

index 25b5e2b4fc747c61483b4e4b7ab8c31799c491a2..1ace677a73970a90d026c49e64bf4298f446db4e 100644 (file)
@@ -2963,15 +2963,15 @@ gdk_window_x11_set_background (GdkWindow      *window,
     {
       GdkWindow *parent;
 
-      /* X throws BadMatch if the parent has a different visual when
+      /* X throws BadMatch if the parent has a different depth when
        * using ParentRelative */
       parent = gdk_window_get_parent (window);
-      if (parent && gdk_window_get_visual (parent) == gdk_window_get_visual (window))
+      if (parent && window->depth != parent->depth)
         XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
-                                    GDK_WINDOW_XID (window), ParentRelative);
+                                    GDK_WINDOW_XID (window), None);
       else
         XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
-                                    GDK_WINDOW_XID (window), None);
+                                    GDK_WINDOW_XID (window), ParentRelative);
       return;
     }